<style lang='scss' scoped>
	.course {
		.top {
			display: flex;
			height: 80rpx;
			align-items: center;

			text {
				width: 100rpx;
				text-align: center;
			}

			.title {
				text-align: center;
				flex: 1;
			}
		}

		.image {
			image {
				width: 100%;
			}
		}
	}
</style>
<template>
	<view class='course'>
		<div class="top">
			<text @click="$router.back()">返回</text>
			<view class="title">
				{{courselist.title}}
			</view>
		</div>
		<view class="image">
			<image :src="courselist.cover || '../../static/logo.png'" mode="widthFix"></image>
		</view>
	</view>
</template>

<script>
	import {
		api
	} from '@/utils/index.js'
	export default {
		data() {
			return {
				courselist: {},
				courseID: ''
			}
		},
		onLoad(o) {
			console.log(o.id);
			this.courseID = o.id

		},
		onShow() {
			this.getlist()
		},
		methods: {
			async getlist() {
				// http://demonuxtapi.dishait.cn/mobile/group_work/list?group_id=29&page=1
				// http://demonuxtapi.dishait.cn/mobile/course/read?id=527&column_id=0&group_id=0&flashsale_id=0
				const response = await api({
					url: `course/read?id=${this.courseID}&column_id=0&group_id=0&flashsale_id=0`,
					method: "GET"
				})
				if (response.code == 20000) {
					console.log(response.data);
					this.courselist = response.data
				}
			}
		}
	}
</script>
